<template>
	 <page-meta :root-font-size="`${fontSize}px`"></page-meta>
	<view>
		<view style="display: flex;align-items:baseline;color:#3E91E6;font-size: 28rpx ;padding:40rpx 72rpx;">
			<view style="margin-right: 50rpx;" :class="{'party-rank-tab-active':current==1}" @click="setOrder(1)">
				按解决问题数
			</view>
			<view :class="{'party-rank-tab-active':current==2}" @click="setOrder(2)">
				按质效评价分
			</view>
		</view>
		<view style="font-size: 32rpx;padding:0 40rpx ;">
			<template v-if="current==1">
				<view class="party-rank-item" v-for="(item,index) in list1" :key="index">
					<view style="width: 60rpx;text-align: center;">
						<image v-if="index==0" src="../static/img/rank1.png" style="width: 55rpx;height: 55rpx;"
							mode="">
						</image>
						<image v-if="index==1" src="../static/img/rank2.png" style="width: 55rpx;height: 55rpx;"
							mode="">
						</image>
						<image v-if="index==2" src="../static/img/rank3.png" style="width: 55rpx;height: 55rpx;"
							mode="">
						</image>

						<template v-if="index>2">
							{{index+1}}
						</template>
					</view>
					<view style="width: 200rpx;padding-left: 30rpx;">
						{{item.name}}
						<view style="font-size: 24rpx;color: #4874FF;">
							{{(list2.find(x=>x.name==item.name) ||  {value:5}).value.toFixed(1)}} 分
						</view>
					</view>
					<view style="flex:1;text-align: right;padding-right: 30rpx;">
						{{item.value}} 件
					</view>
				</view>
			</template>
			<template v-else>

				<view class="party-rank-item" v-for="(item,index) in list2" :key="index">
					<view style="width: 60rpx;text-align: center;">
						<image v-if="index==0" src="../static/img/rank1.png" style="width: 55rpx;height: 55rpx;"
							mode="">
						</image>
						<image v-if="index==1" src="../static/img/rank2.png" style="width: 55rpx;height: 55rpx;"
							mode="">
						</image>
						<image v-if="index==2" src="../static/img/rank3.png" style="width: 55rpx;height: 55rpx;"
							mode="">
						</image>

						<template v-if="index>2">
							{{index+1}}
						</template>
					</view>
					<view style="width: 200rpx;padding-left: 30rpx;">
						{{item.name}}
						<view style="font-size: 24rpx;color: #4874FF;">
							{{list1.find(x=>x.name==item.name).value}} 件
						</view>
					</view>
					<view style="flex:1;text-align: right;padding-right: 30rpx;">
						{{item.value.toFixed(1)}} 分
					</view>
				</view>

			</template>
		</view>
	</view>
</template>

<script>
	import { mapState } from 'vuex'
	export default {
		computed: {
			...mapState(['fontSize'])
		},
		data() {
			return {
				current: 1,
				list1: [],
				list2: [],
			}
		},
		mounted() {
			uni.setStorageSync('projId', 159)
			if (uni.getStorageSync('projId') == 159) {
				 this.list1 = [
				        { name: "朱敏燕", value: 2+1 },
				        { name: "孙志良", value: 8 },
				        { name: "缪海云", value: 4 },
				        { name: "曹定妹", value: 4 },
				        { name: "沈建宝", value: 5 },
				        { name: "曹国林", value: 3 },
				        { name: "凡琦", value: 2 },
				        { name: "黄敏珠", value: 2 },
				        { name: "曹建林", value: 2 },
				        { name: "方毛毛", value: 2 },
				        { name: "曹松松", value: 1 },
				        { name: "冯益明", value: 1 },
				        { name: "高祺佳", value: 1 },
				        { name: "谢明", value: 1 },
				        { name: "陈汉玉", value: 1 },
				        { name: "陈美珍", value: 1 },
				        { name: "方宝福", value: 1 },
				        { name: "冯掌松", value: 1 },
				        { name: "高金根", value: 1 },
				        { name: "高景祥", value: 1 },
				        { name: "高妙根", value: 1 },
				        { name: "郎建娣", value: 1 },
				        { name: "沈冬玉", value: 1 },
				        { name: "汤其虎", value: 1 },
				        { name: "夏雄飞", value: 1 },
				        { name: "夏叶顺", value: 1 },
				        { name: "周向华", value: 1 },
				        { name: "邹丽娟", value: 1 },
				      ];
				      this.list2 = [
				        { name: "朱敏燕", value: 5.0 },
				        { name: "孙志良", value: 4.63 },
				        { name: "缪海云", value: 4.5 },
				        { name: "曹定妹", value: 4.5 },
				        { name: "沈建宝", value: 4.4 },
				        { name: "曹国林", value: 5 },
				        { name: "凡琦", value: 5 },
				        { name: "黄敏珠", value: 5 },
				        { name: "曹建林", value: 5 },
				        { name: "方毛毛", value: 4.5 },
				        { name: "曹松松", value: 5 },
				        { name: "冯益明", value: 5 },
				        { name: "高祺佳", value: 5 },
				        { name: "谢明", value: 5 },
				        { name: "陈汉玉", value: 4 },
				        { name: "陈美珍", value: 4 },
				        { name: "方宝福", value: 4 },
				        { name: "冯掌松", value: 4 },
				        { name: "高金根", value: 4 },
				        { name: "高景祥", value: 4 },
				        { name: "高妙根", value: 4 },
				        { name: "郎建娣", value: 4 },
				        { name: "沈冬玉", value: 4 },
				        { name: "汤其虎", value: 4 },
				        { name: "夏雄飞", value: 4 },
				        { name: "夏叶顺", value: 4 },
				        { name: "周向华", value: 4 },
				        { name: "邹丽娟", value: 4 },
				      ];
			}
			if (uni.getStorageSync('projId') == 208) {
				 this.list1 = [
				        { name: "周婷", value: 9+1 },
				        { name: "吕永连", value: 5+1 },
				        { name: "陈国强", value: 3+1 },
				        { name: "吕伟勇", value: 3+1 },
				        { name: "方平", value: 3+1 },
				        { name: "张春香", value: 4+1 },
				        { name: "胡江平", value: 5+1 },
				        { name: "林建新", value: 4+1 },
				        { name: "朱荣高", value: 3 },
				        { name: "朱根田", value: 1 },
				        { name: "朱爱琴", value: 1 },
				        { name: "许敏捷", value: 5 },
				        { name: "高燕", value: 4 },
				        { name: "陈倩芸", value: 3 },
				        { name: "田永才", value: 3 },
				        { name: "江敏伟", value: 2 },
				        { name: "翁周生", value: 2 },
				        { name: "骆阳", value: 3 },
				        { name: "莫青华", value: 2 },
				        { name: "郭武军", value: 2 },
				        { name: "白俊虎", value: 1 },
				        { name: "任晨阳", value: 2 },
				        { name: "林素玲", value: 2 },
				        { name: "王金荣", value: 4 },
				        { name: "石宗昌", value: 1 },
				        { name: "干伟洋", value: 2 },
				        { name: "王盈盈", value: 1 },
				        { name: "吕伟虎", value: 1 },
				        { name: "郑志兴", value: 1 },
				        { name: "周莹", value: 1 },
				        { name: "方杰", value: 2 },
				        { name: "郑金虎", value: 2 },
				        { name: "骆阿林", value: 3 },
				        { name: "顾欣", value: 1 },
				        { name: "朱祺栋", value: 3 },
				        { name: "任妙松", value: 2 },
				      ];
				      this.list2 = [
				        { name: "周婷", value: 4.6 },
				        { name: "吕永连", value: 4.6 },
				        { name: "陈国强", value: 4.7 },
				        { name: "吕伟勇", value: 4.7 },
				        { name: "方平", value: 4.7 },
				        { name: "张春香", value: 4.5 },
				        { name: "胡江平", value: 4.6 },
				        { name: "林建新", value: 4.5 },
				        { name: "朱荣高", value: 4.3 },
				        { name: "朱根田", value: 4 },
				        { name: "朱爱琴", value: 4 },
				        { name: "许敏捷", value: 5 },
				        { name: "高燕", value: 4.3 },
				        { name: "陈倩芸", value: 4.3 },
				        { name: "田永才", value: 4.33 },
				        { name: "江敏伟", value: 4.5 },
				        { name: "翁周生", value: 4.5 },
				        { name: "骆阳", value: 4.3 },
				        { name: "莫青华", value: 4 },
				        { name: "郭武军", value: 4.5 },
				        { name: "白俊虎", value: 5 },
				        { name: "任晨阳", value: 4.5 },
				        { name: "林素玲", value: 5 },
				        { name: "王金荣", value: 4.8 },
				        { name: "石宗昌", value: 4 },
				        { name: "干伟洋", value: 4.5 },
				        { name: "王盈盈", value: 5 },
				        { name: "吕伟虎", value: 4 },
				        { name: "郑志兴", value: 5 },
				        { name: "周莹", value: 4 },
				        { name: "方杰", value: 5 },
				        { name: "郑金虎", value: 4.5 },
				        { name: "骆阿林", value: 4.7 },
				        { name: "顾欣", value: 4 },
				        { name: "朱祺栋", value: 4.3 },
				        { name: "任妙松", value: 4.5 },
				      ];
			}
			this.setOrder(1)
		},
		methods: {
			setOrder(order) {
				this.current = order
				if (order == 1) {
					this.list1 = this.list1.sort((y, x) => x.value - y.value)
				} else {
					this.list2 = this.list2.sort((y, x) => x.value - y.value)
				}
			}
		}
	}
</script>

<style>
	.party-rank-tab-active {
		color: #333333;
		font-size: 36rpx;
		font-weight: bold;
		position: relative;
		z-index: 1;
	}

	.party-rank-tab-active::before {
		position: absolute;
		content: "";
		width: 220rpx;
		height: 16rpx;
		display: block;
		transform: translate(-5rpx, 30rpx) skew(-50deg);
		background-color: #FFD487;
		z-index: -1;

	}

	.party-rank-item {
		display: flex;
		padding: 20rpx;
	}
</style>
